<template>
  <div class="back-btn" @click="handleNavigateHome">
    <i-ep-arrow-left class="arrow-left-icon" />
    <span>返回</span>
  </div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'
import { get as _get } from 'lodash-es'
import { FormType } from '@/management/utils/types/formsTypes';
const router = useRouter()
const store = useStore()

const formType = computed(() => _get(store.state, 'editform.schema.metaData.formType'))
const handleNavigateHome = () => {
  router.push({
    name: formType.value === FormType.System ? 'templates' : 'forms'
  })
}
</script>
<style lang="scss" scoped>
.back-btn {
  height: 100%;
  display: flex;
  align-items: center;
  cursor: pointer;
  .arrow-left-icon {
    margin-right: 5px;
  }
}
</style>
